<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>ng-init 与ng-trim 及表单中表单value与$scope数据提交差异分析</title>
    <script src="../angular.js"></script>
</head>
<body>
    <!--ng-init 临时赋值name-->
    <!--ng-trim 清楚两边的字符，默认是空格-->
    <!--ng-model 默认包含 ng-trim-->
    <div ng-app="gg" ng-controller="ctrl" ng-init="name='gg'">
        {{name}}
        <form action="16.php" method="post">
            标题： <input type="text" name="title" ng-model="title" ng-value="title"><br />
            <!--data : <input type="text" name="data" ng-value="title"><br/>-->
            <input type="submit" value="提交">
        </form>
        {{title}}
    </div>

    <script>
       var mod = angular.module('gg', []);
       mod.controller('ctrl', ['$scope', function ($scope) {
           $scope.title = '';
       }])
    </script>
</body>
</html>